<template>
	<div class="sf-success-box">
		<div class="sf-container">
			<div class="sf-success"></div>
			<p class="seckill-pay-success-inform">
				{{ texts }}
			</p>
		</div>
		<div class="mycardBox" v-show="mycardBox">
			<a :href="linkUrl">
				查看订单详情
			</a>
		</div>
		<div class="mycardBox sureBtn" v-show="mycardBox">
			<a :href="linkUrl">
				确定
			</a>
		</div>
		<div>
  			<iframe :src="iframe" style="display: none" v-if="isIOSWechat"></iframe>
		</div>
	</div>
</template>

<script>
	import common from '../../utils/common.js';

	export default {
	    data: function(){
	    	return {
	    		texts:'',
	    		mycardBox: false,
	    		iframe:'',
	    		isIOSWechat: common.isIOSWechat(),
	    		linkUrl:sessionStorage.successLink
	    	}
	    },
	    ready: function(){
	    	this.skip('mycard');
	    	this.iframe = common.setTitleAgain('下单成功', this.iframe);

	    	window.ANA.reconfig('').getDate().dataProcess().send();//埋点

/*	    	localStorage.thisCardServer = '';
	    	sessionStorage.cacheSeverLocalStorage = '';*/
/*	    	common.setTitle("下单成功");
*/	    },
	    methods: {
	    	skip: function (state){
	    		var upData = '成功',urlSet;
	    		if(process.env.NODE_ENV === 'integration'){

	    			urlSet = 'chexiangsit';

	    		}else if(process.env.NODE_ENV === 'preview'){
	    			urlSet = 'pre';
	    		}else if(process.env.NODE_ENV === 'production'){
	    			urlSet = 'chexiang';
	    		}
	    		console.log(urlSet);
	    		switch(state){
					case 1:
						this.texts = '成功啦';
					  	this.loactionSkip('//member.'+ urlSet +'.com/m/order/cxjOrderlist.htm');
					  	break;

					case 'mycard':
						this.texts = '下单成功';
						this.mycardBox = true;
						//this.$set('texts', '22222');
						//this.$set('mycardBox', true);
					  	break;  
				}
	    	},
	    	loactionSkip: function(address){
	    		clearTimeout(setTimeSkip);
	    		var setTimeSkip = setTimeout(function(){
	    			window.location.href = address;
	    		},3000)
	    	}

	    }
	   
	}
</script>

<style lang="scss">
	@import "../../assets/css/_functions.scss";
	@import "../../assets/css/_variables.scss";
	@function rem($px){
	  @return $px / 10 * 1rem;
	}  
	body {
		height: 100%;
	}
	.sf-container {
		padding: rem(78) 0 rem(58) 0;
		background-color: #fff;
	}
	.sf-success {
		margin: 0 auto rem(25) auto;
	}
	.seckill-pay-success-inform {
		text-align: center;
		font-size: rem(20);
		font-weight: bold;
	}
	.mycardBox {
		width:rem(277);
		height: rem(48);
		line-height: rem(48);
		padding: 0 rem(14);
		margin-top: rem(10);
		background-color: #4a90e2;
		font-size: rem(14);
		text-align:center;
		border-radius:5px;
		margin:0 auto rem(10);
		a {
			display: block;
			color: #fff;
			font-size:rem(15);

		}
		.sf-arrow-right {
			float: right;
			margin-top: rem(15);
		}
	}
	.sureBtn{
		background:#fff;
		border:1px solid #c9d5e0;		
		a{
			color:#8392a0;
		}
	}
</style>